package com.wuge.controller;

import com.wuge.service.ProductSeachService;
import com.wuge.vo.SearchParm;
import com.wuge.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
public class SeachController {
    @Resource
    ProductSeachService productSeachService;
    @RequestMapping("/list.html")
    public String list(SearchParm searchParm, Model model, HttpServletRequest httpServletRequest){
        try{
            SearchResult searchResult = productSeachService.searchByParm(searchParm,httpServletRequest);
            model.addAttribute("result",searchResult);
        }
        catch (Exception e){
            e.printStackTrace();
        }
        return "list";
    }
}
